package com.tem.system.utils;

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class Test {
    public static void main(String[] arsg){
        //PathMatcher pathMatcher = new AntPathMatcher();
        //System.out.println(pathMatcher.match("/content/api/front/**", "/content/api/front/content/cmsTypeFront/list"));

        /*MyStringUtil myStringUtil = MyStringUtil.getInstance();
        System.out.println(myStringUtil.hashCode());

        System.out.println(MyStringUtil.getInstance().hashCode());

        System.out.println(MyStringUtil.getInstance().hashCode());*/
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(MyStringUtil.getInstance().hashCode());
            }
        });
        thread1.start();

        MyThread myThread = new MyThread();//继承Thread
        myThread.start();

        MyThread2 myThread2 = new MyThread2();//实现Runnable
        Thread myt3 = new Thread(myThread2);
        myt3.start();
        (new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(MyStringUtil.getInstance().hashCode());
            }
        })).start();

        //线程池管理线程
        ExecutorService execc = Executors.newSingleThreadExecutor();
        execc.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("-----1---"+MyStringUtil.getInstance().hashCode());
            }
        });
        execc.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("-----2---"+MyStringUtil.getInstance().hashCode());
            }
        });
        execc.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("-----3---"+MyStringUtil.getInstance().hashCode());
            }
        });
        execc.shutdown();
    }
}
class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println(MyStringUtil.getInstance().hashCode());
    }
}


class MyThread2 implements Runnable{
    @Override
    public void run() {
        System.out.println("这是实现Runnable接口创建的线程");
    }
}
